<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="com.lmpop.trade.ts_link_group.*"%>
<%@ page import="com.lmpop.trade.ti_link.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.lmpop.trade.ti_case.*"%>
<%@ page import="com.lmpop.trade.ti_membercurrency.*"%>
<%@page import="com.lmpop.trade.ts_area.*"%>
<%@ page import="com.lmpop.trade.ts_category.*"%>
<%@ page import="com.lmpop.trade.tb_commpara.*"%>
<%
	String cust_id = "";
	if (session.getAttribute("session_cust_id") != null) {
		cust_id = session.getAttribute("session_cust_id").toString();
	}
	String case_id = "";
	if (request.getParameter("case_id") != null)
		case_id = request.getParameter("case_id").toString();

	Ti_caseInfo ti_caseInfo = new Ti_caseInfo();
	List list = ti_caseInfo.getListByPk(case_id);
	Hashtable map = (Hashtable) list.get(0);
	String case_date = "", area_attr = "", case_amount = "", case_title = "", case_content = "", operator_id = "", 
	case_state = "", end_time = "", cat_attr = "", case_type = "", case_desc = "", operator_date = "",memberscurrency_id="",
	delegate_fee="",delegate_tel="",delegate_name="",contact_sum="",case_source="";
	String area_str="";
	StringBuffer catattr = new StringBuffer();
	Ts_categoryInfo ts_categoryInfo = new Ts_categoryInfo();
	if (map.get("case_date") != null)
		case_date = map.get("case_date").toString();
	if (map.get("area_attr") != null){
		area_attr = map.get("area_attr").toString();
		if (area_attr != null && !"".equals(area_attr)) {
		Ts_areaInfo areaBean = new Ts_areaInfo();
				String areaArr[] = area_attr.split("\\|");
				for (int k = 0; k < areaArr.length; k++) {
					area_str = area_str + " &nbsp; "
							+ areaBean.getAreaNameById(areaArr[k]);
				}
			}
	}
	if (map.get("case_amount") != null)
		case_amount = map.get("case_amount").toString();
	if (map.get("case_title") != null)
		case_title = map.get("case_title").toString();
	if (map.get("case_content") != null)
		case_content = map.get("case_content").toString();
	if (map.get("operator_id") != null)
		operator_id = map.get("operator_id").toString();
	if (map.get("end_time") != null){
		end_time = map.get("end_time").toString();
		end_time=end_time.substring(0,10);
	}
	if (map.get("case_state") != null)
		case_state = map.get("case_state").toString();
	if (map.get("cat_attr") != null){
		cat_attr = map.get("cat_attr").toString();
			 
			 if(!cat_attr.equals("")){
				  String cat_attrIds[] = cat_attr.split("\\|");	
				  for(String catId:cat_attrIds){
						catattr.append(ts_categoryInfo.getCat_nameById(catId)+"&nbsp;");
					  }                 
				}
	}
		
	if (map.get("case_type") != null)
		case_type = map.get("case_type").toString();
	if (map.get("case_desc") != null)
		case_desc = map.get("case_desc").toString();
	if (map.get("case_source") != null)
		case_source = map.get("case_source").toString();
	if (map.get("operator_date") != null)
		operator_date = map.get("operator_date").toString();
	if(map.get("delegate_fee") != null)
		delegate_fee = map.get("delegate_fee").toString();
	if(map.get("delegate_tel") != null)
		delegate_tel=map.get("delegate_tel").toString();
	if(map.get("delegate_name")!=null)
		delegate_name=map.get("delegate_name").toString();
	if(map.get("contact_sum")!=null)
		contact_sum=map.get("contact_sum").toString();
	if(map.get("memberscurrency_id")!=null)
		memberscurrency_id = map.get("memberscurrency_id").toString();
	
	Ti_membercurrencyInfo ti_membercurrencyInfo = new Ti_membercurrencyInfo();
	String selelctlist = ti_membercurrencyInfo.getSelectString(memberscurrency_id);
	 Tb_commparaInfo tb_commparaInfo = new Tb_commparaInfo(); 
 	String s_case_source = tb_commparaInfo.getSelectItem("112",case_source);   
%>
<html>
	<head>
		<title>案源信息管理</title>
		<link href="/program/admin/index/css/style.css" rel="stylesheet"
			type="text/css">
		<script type="text/javascript" src="/js/commen.js"></script>
		<script type="text/javascript" src="ti_case.js"></script>
		<script language="javascript" type="text/javascript"
			src="/program/plugins/calendar/WdatePicker.js"></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/interface/Ts_areaInfo.js'></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/engine.js'></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/util.js'></script>
		<script type="text/javascript" src="js_personal.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/interface/Ts_categoryInfo.js"></script>
		<script type="text/javascript">setcat_attr1('');</script>
	</head>

	<body>

		<h1> 
			修改案源信息 
		</h1>
		<form action="/doTradeReg.do" method="post" name="addForm">
			<table width="100%" cellpadding="1" cellspacing="1" border="0"
				class="listtab">
				<table width="100%" cellpadding="0" cellspacing="1" border="0"
					class="listtab">

					<tr>
						<td align="right" width="10%">
							案件标题
							<font color="red">*</font>
						</td>
						<td width="30%">
							<input name="case_title" id="case_title" type="text" value="<%=case_title %>" />
						</td>
						<td align="right" width="10%">
							涉案地点
							<font color="red">*</font>
						</td>
						<td width="70%">
							<p><%=area_str %>
							<input type="button" class="buttoncss" name="" value="修改"
								onclick="showDiv(1)" />
							</p>
							<div id="area_div" style="display: none;">
								<select name="province" id="province"
								onchange="setCitys(this.value,'')">
								<option value="">
									省份
								</option>
							</select>
							<select name="eparchy_code" id="eparchy_code"
								onchange="setAreas(this.value,'')">
								<option value="">
									地级市
								</option>
							</select>
							<select name="city_code" id="city_code" style="display: inline">
								<option value="">
									市、县级市、县
								</option>
							</select>
							</div>
							
							<input type="hidden" name="area_attr_bak" id="area_attr_bak"
								value="" />
							<input type="hidden" name="area_attr" id="area_attr" value="<%=area_attr %>" />
						</td>
					</tr>

				

<tr>
					<td align="right" width="10%">
						联系方式
					</td>
					<td width="30%">
						<input type="text" id="delegate_tel" name="delegate_tel" value="<%=delegate_tel %>" onKeyUp="if(isNaN(value))this.value=''">
					</td>
					<input name="real_name" id="real_name" type="hidden" />
					<td align="right" width="10%">
						委托者姓名
					</td>
					<td width="30%">
						<input type="text" id="delegate_name" name="delegate_name" value="<%=delegate_name %>">
					</td>
				</tr>
				<tr>
		<td align="right" width="10%">
							截止日期:
						</td>
						<td>
							<input name="end_time" id="end_time" type="text" class="Wdate"
								value="<%=end_time%>"
							onClick="WdatePicker({minDate:'%y-%M-%d',readOnly:true})" 
								size="15" width="150px" />
						</td>
					<td align="right" width="10%">委托费</td>
					<td  width="30%"><input type="text" name="delegate_fee" id="delegate_fee" value="<%=delegate_fee %>"></td>
				</tr>
<tr>
					<td align="right" width="10%">
						案源级别
					</td>
					<td>
						<select id="memberscurrency_id" name="memberscurrency_id" >
							<option value="">请选择</option>
							<%=selelctlist%>
						</select>
						<input type="hidden" name="case_level" id="case_level" value="<%=memberscurrency_id %>" >
					</td>
					<td align="right" width="10%">案件来源</td>
					<td>
						<select name="case_source">
							<%=s_case_source %>
						</select>
					</td>
				</tr>
					<tr>
						<td align="right" width="10%">
							案件分类:
						</td>
						<td>
							<p><%=catattr %>
								<input type="button" class="buttoncss" name="" value="修改"
								onclick="showDiv(2)" />
							</p>
							<div id="cat_div" style="display: none;">
							<select name="cat_attr1" id="cat_attr1"
							onchange="setcat_attr2(this.value,'')">
							<option value="">
								初级分类
							</option>
						</select>
						<select name="cat_attr2" id="cat_attr2">
							<option value="">
								二级分类
							</option>
						</select>
						</div>
						<input type="hidden" id="cat_attr" name="cat_attr" value="<%=cat_attr %>" >
						</td>
						<td align="right" width="10%">
							案源简介:
						</td>
						<td>
							<input name="case_desc" id="case_desc" type="text" value="<%=case_desc %>" >
						</td>
					</tr>
						<tr>
						<td align="right" width="10%">
							涉案金额
						</td>
						<td colspan="3">
							<input name="case_amount" id="case_amount" type="text" value="<%=case_amount %>" onKeyUp="if(isNaN(value))this.value=''"/>
						</td>
					<!-- 
						<td align="right" width="10%">
							涉案时间
						</td>
						<td width="30%">
							<input name="case_date" type="text" id="case_date" class="Wdate"
								value="<%=case_date %>"
								onclick="WdatePicker({maxDate:'#F{$dp.$D(\'end_time\',{d:-1})}',readOnly:true})"
								size="15" width="150px" />
						</td>
					 -->
					</tr>
					<tr>
						<td>
							案件经过:
						</td>
						<td colspan="3">
							<textarea name="case_content" id="case_content"><%=case_content %></textarea>
							<script type="text/javascript"
								src="/program/plugins/ckeditor/ckeditor.js"></script>
							<script type="text/javascript">
			   CKEDITOR.replace( 'case_content',{});  
			</script>
						</td>
					</tr>


				</table>

				<table width="100%" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td align="center">
							<input type="hidden" name="case_state" value="<%=case_state%>">
							<input type="hidden" name="case_id" value="<%=case_id%>">
							<input type="hidden" name="bpm_id" value="0463" />
							<input type="hidden" name="contact_sum" id="contact_sum" value="<%=contact_sum %>" >
							<input type="hidden" name="cust_id" value="<%=cust_id%>">
							<input type="submit" class="buttoncss" name="tradeSub" value="提交"
								onclick="return checkInfo()" />
							&nbsp;&nbsp;
							<input type="button" class="buttoncss" name="tradeRut" value="返回"
								onclick="window.location.href='';" />
						</td>
					</tr>
				</table>
				</form>
	</body>
<script type="text/javascript">setProvince();</script>
</html>